import config from '@/config';
import RequestBase from '@/utils/request.js';

const baseRequest = new RequestBase(config.education);

// 题库训练
export const getExaminationList = (query) => {
  return baseRequest.get('/examination/train/list', query);
};
// 模拟考试
export const getExaminationRandom = (query) => {
  return baseRequest.get('/examination/random', query);
};
// APP根据试题类别和类型随机获取题目
export const getAppExaminationRandom = (query) => {
  return baseRequest.get('/examination/app/random', query);
};
// 获取APP模拟训练答题卡内容
export const getAppExaminationRecord = (query) => {
  return baseRequest.get('/examination/app/record', query);
};

// 新增模拟考试答题详情
export const addMockTestResult = (typeId, data) => {
  return baseRequest.post(
    '/simulation-exam-detail?examinationTypeId=' + typeId,
    data
  );
};

// 题库训练已做/未做题目数量
export const questionSituation = (examinationTypeId) => {
  return baseRequest.get(`/simulation-exam-detail/count/${examinationTypeId}`);
};

// 清除题库训练记录
export function deleteQuestionRecord(examinationTypeId) {
  return baseRequest.delete(`/simulation-exam-detail/${examinationTypeId}`);
}

// 保存题库训练记录
export const saveTestRecord = (data) => {
  return baseRequest.post('/simulation-exam-detail/detail/training', data);
};

// 模拟考试交卷新接口
export const handin = (data) => {
  return baseRequest.post('/simulation-exam-detail/detail/exam', data);
};

//题库训练结果
export const trainResult = (examinationTypeId) => {
  return baseRequest.get(`/simulation-exam-detail/record/${examinationTypeId}`);
};
